/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.loja.view.swing.model;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author CASA
 */
public abstract class EntityTableModel<T> extends AbstractTableModel {

        private static final long serialVersionUID = 1L;

        protected List<T> entities = new ArrayList<>();
        protected List<String> columns;

        @Override
        public String getColumnName(int column) {
                return columns.get(column);
        }

        @Override
        public int getColumnCount() {
                return columns.size();
        }

        @Override
        public int getRowCount() {
                return entities.size();
        }

        public List<T> getEntities() {
                return entities;
        }

        public void setEntities(List<T> entities) {
                this.entities = entities;
        }
}